#include "list_stack.h"
#include <stdio.h>

// c风格
void list_stack_test_c()
{
    printf("c 风格\n");
    struct list_stack s;
    list_stack_init(&s);

    push(&s, 1);
    push(&s, 2);
    push(&s, 3);
    push(&s, 4);
    push(&s, 5);
    show(&s);
    int value;
    peek(&s, &value);
    printf("peek: %d\n", value);

    pop(&s);
    show(&s);
    peek(&s, &value);
    printf("peek: %d\n", value);
    clear(&s);
}

// c with class 风格
void list_stack_test_c_class()
{
    printf("c with class 风格\n");
    struct list_stack s;
    list_stack_init(&s);

    s.push(&s, 1);
    s.push(&s, 2);
    s.push(&s, 3);
    s.push(&s, 4);
    s.push(&s, 5);
    s.show(&s);
    int value;
    s.peek(&s, &value);
    printf("peek: %d\n", value);

    s.pop(&s);
    s.show(&s);
    s.peek(&s, &value);
    printf("peek: %d\n", value);
    s.clear(&s);
}

int main()
{
    list_stack_test_c();
    list_stack_test_c_class();

    return 0;
}